<?php

/**
 * Referee form base class.
 *
 * @method Referee getObject() Returns the current form's model object
 *
 * @package    makethetouch
 * @subpackage form
 * @author     Sebastien Chassande-Barrioz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseRefereeForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'user'                    => new sfWidgetFormInputHidden(),
      'level1_course_date'      => new sfWidgetFormDate(),
      'level1_test_result'      => new sfWidgetFormInputText(),
      'level1_valid_date'       => new sfWidgetFormDate(),
      'level2_course_date'      => new sfWidgetFormDate(),
      'level2_test_result'      => new sfWidgetFormInputText(),
      'level2_valid_date'       => new sfWidgetFormDate(),
      'level2_valid_tournament' => new sfWidgetFormInputText(),
      'level3_course_date'      => new sfWidgetFormDate(),
      'level3_test_result'      => new sfWidgetFormInputText(),
      'level3_valid_date'       => new sfWidgetFormDate(),
      'level4_valid_date'       => new sfWidgetFormDate(),
      'level5_valid_date'       => new sfWidgetFormDate(),
      'level1_course'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course'), 'add_empty' => true)),
      'level2_course'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course_3'), 'add_empty' => true)),
      'level3_course'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course_4'), 'add_empty' => true)),
      'level1_teacher'          => new sfWidgetFormInputText(),
      'level2_teacher'          => new sfWidgetFormInputText(),
      'level3_teacher'          => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'user'                    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('user')), 'empty_value' => $this->getObject()->get('user'), 'required' => false)),
      'level1_course_date'      => new sfValidatorDate(array('required' => false)),
      'level1_test_result'      => new sfValidatorInteger(array('required' => false)),
      'level1_valid_date'       => new sfValidatorDate(array('required' => false)),
      'level2_course_date'      => new sfValidatorDate(array('required' => false)),
      'level2_test_result'      => new sfValidatorInteger(array('required' => false)),
      'level2_valid_date'       => new sfValidatorDate(array('required' => false)),
      'level2_valid_tournament' => new sfValidatorInteger(array('required' => false)),
      'level3_course_date'      => new sfValidatorDate(array('required' => false)),
      'level3_test_result'      => new sfValidatorInteger(array('required' => false)),
      'level3_valid_date'       => new sfValidatorDate(array('required' => false)),
      'level4_valid_date'       => new sfValidatorDate(array('required' => false)),
      'level5_valid_date'       => new sfValidatorDate(array('required' => false)),
      'level1_course'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Course'), 'required' => false)),
      'level2_course'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Course_3'), 'required' => false)),
      'level3_course'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Course_4'), 'required' => false)),
      'level1_teacher'          => new sfValidatorInteger(array('required' => false)),
      'level2_teacher'          => new sfValidatorInteger(array('required' => false)),
      'level3_teacher'          => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('referee[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Referee';
  }

}
